package com.feibiao.computer;

public class OperatorFactory {
    public static Operate getOperatorInstance(String key){
        Operate opera = null;
        switch (key){
            case"+":
                Factory addFactory= new AddFactory();
                opera = addFactory.creatOperation();
                break;
            case"-":
                Factory subFactory= new SubFactory();
                opera = subFactory.creatOperation();
                break;
            case"*":
                Factory mulFactory = new MulFactory();
                opera = mulFactory.creatOperation();
                break;
            case"/":
                Factory divFactory = new DivFactory();
                opera = divFactory.creatOperation();
                break;
            case"=":
                Factory equalFactory = new EqualFactory();
                opera = equalFactory.creatOperation();
                break;
            case"n!":
                Factory jieCFactory = new JieCFactory();
                opera = jieCFactory.creatOperation();
                break;
            case"x^y":
                Factory cf_factory = new CF_Factory();
                opera = cf_factory.creatOperation();
                break;
        }
        return opera;
    }
}
